//73.矩阵置零
//https://leetcode.cn/problems/set-matrix-zeroes/
class Solution {
public:
    void setZeroes(vector<vector<int>>& matrix) {
        int m = matrix.size(), n = matrix[0].size();
        vector<bool> ROW(m, false);
        vector<bool> COL(n, false);

        for (int i = 0; i < m; ++i)
            for (int k = 0; k < n; ++k)
            {
                if (matrix[i][k] == 0)
                {
                    ROW[i] = true;
                    COL[k] = true;
                }
            }

        for (int i = 0; i < m; ++i)
            if (ROW[i]) for (int k = 0; k < n; ++k) matrix[i][k] = 0;
        
        for (int i = 0; i < n; ++i)
            if (COL[i]) for (int k = 0; k < m; ++k) matrix[k][i] = 0;
            
    }
};